package com.caishi.lkx.exam.model;


import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.extension.handlers.FastjsonTypeHandler;
import com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler;
import com.caishi.lkx.exam.ienum.type.PkType;
import com.caishi.lkx.exam.vo.PkData;
import com.caishi.lkx.handler.PkDataListTypeHandler;
import com.caishi.lkx.handler.PkTypeHandler;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.*;
import org.apache.ibatis.type.EnumTypeHandler;

import java.time.LocalDateTime;
import java.util.List;
import java.util.Map;

@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@TableName(value = "pk_room", autoResultMap = true)
public class PkRoom {
    @TableId(value = "id", type = IdType.AUTO)
    private Integer id;
    //    pk试卷
//    试题是两个人都有的公共试题，点击按钮时，获取是否有购买考试的，没购买就没权限
//    pk的题应该是单选多选判断，简单配置，题出30道，分数1分至2分
//    pk模式下，记录时间，退出后重登恢复
    @TableField(typeHandler = FastjsonTypeHandler.class)
    private List<Map<String, Object>> questions;

    private String person1;

    private String person1Name;
    private String header1;
    private String person2;

    private String person2Name;
    private String examId;
    private String header2;
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private LocalDateTime startTime;
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private LocalDateTime endTime;
    private Boolean finished;
    @TableField(typeHandler = PkTypeHandler.class)
    private PkType type;
    private String roomName;
    private String sessionId1;
    private String sessionId2;

    private Integer score1;
    private Integer score2;
    private Integer doNum1;
    private Integer doNum2;
    @TableField(typeHandler = PkDataListTypeHandler.class)
    private List<PkData> data1;
    @TableField(typeHandler = PkDataListTypeHandler.class)
    private List<PkData> data2;
    private Integer total;
    private String sign;

}
